#!/bin/bash

echo "下载压缩包"
wget https://studygolang.com/dl/golang/go1.16.7.linux-amd64.tar.gz
echo "解压压缩包"
tar -xvf go1.16.7.linux-amd64.tar.gz
echo "移动到 /usr/local"
mv go /usr/local
echo "配置环境变量"
echo "export GOROOT=/usr/local/go" >> ~/.bashrc
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
echo "export GOPROXY=https://goproxy.cn,direct" >> ~/.bashrc
source ~/.bashrc
echo "检测安装"
go version
go env